package com.luych.toolbox.docker.service.sdk.volume;

import com.luych.toolbox.docker.service.sdk.volume.model.DockerVolumeInspectResult;
import org.springframework.web.client.RestTemplate;

public class DockerVolume {

    private final String url;
    private final String id;

    public DockerVolume(String url, String id) {
        this.url = url;
        this.id = id;
    }

    public DockerVolumeInspectResult inspect() {
        final String uri = url + "/volumes/{id}";
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate.getForObject(uri, DockerVolumeInspectResult.class, id);
    }

    public void remove() {
        final String uri = url + "/volumes/{id}";
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.delete(uri, id);
    }
}
